/*
 * @Description: 
 * @version: 
 * @Author: hui.wang01
 * @Date: 2021-03-18 17:12:36
 * @LastEditors: hui.wang01
 */
import axios from 'axios';

const uploadImg = (file, size,requestHost) => {
  const formData = new FormData();
  return new Promise((resolve, reject )=> {
      formData.append('file', file);
      axios({
        url: `${requestHost+'/tapd/image'}`,
        method: 'POST',
        headers: {'channel-type': 'h5' },
        data: formData,
      }).then(p => resolve(p.data)).catch((e) => {
        reject(e)
      });
  });
};

export const savePopform = (data,requestHost) => {
  return new Promise((resolve, reject )=> {
      axios({
        url: `${requestHost+'/tapd/report'}`,
        method: 'POST',
        headers: {
          'channel-type': 'h5',
          'Content-Type': 'application/json'
        },
        data: data,
      }).then(p => resolve(p.data)).catch((e) => {
        reject(e)
      });
  });
};
export default uploadImg;
